export function formatDateToDateString (date) {
  let y = date.getFullYear();
  let m = date.getMonth() + 1;
  m = m < 10 ? ('0' + m) : m;
  let d = date.getDate();
  d = d < 10 ? ('0' + d) : d;
  return y + '年' + m + '月' + d + '日';
};

export function formatDateToTimestamps (date) {
  let y = date.getFullYear();
  let m = date.getMonth() + 1;
  m = m < 10 ? ('0' + m) : m;
  let d = date.getDate();
  d = d < 10 ? ('0' + d) : d;
  return y + '-' + m + '-' + d;
};

export function formatDateToSlashString (date) {
  return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate();
};

export function getDateStringOfYesterday () {
  let yesterday = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
  return formatDateToTimestamps(yesterday);
}
